import { request } from "../api/request";
import { LOGINPNG_URL, LOGIN_URL, RS_URL, VRLOGIN_URL } from "../constants/url";
import { useMutation } from "@tanstack/react-query";

const loginFn = async ({ userName, passwd }) => {
  //
  const { data } = await request({
    url: LOGIN_URL,
    data: {
      password: passwd,
      userId: userName,
    },
    // params: {
    //   code: vrCode,
    // },

    method: "post",
  });
  return {
    data,
  };
};

export default function useLogin() {
  return useMutation(["login"], loginFn);
}
